''' Answer Bot program with function and parameter Mission 8 -- Answer Bot Solution with delay parameter ''' from codex import * import random from time import sleep answers = ["The odds are yes", "It is not in the stars", "Go for the gold!", "Today is your day", "Stay home and read", "Have an adventure"] # === Functions def pixel_colors(delay): pixels.set(0, random.choice(COLOR_LIST)) pixels.set(1, random.choice(COLOR_LIST)) pixels.set(2, random.choice(COLOR_LIST)) pixels.set(3, random.choice(COLOR_LIST)) sleep(delay) # === Main Program while True: delay = random.randrange(1, 10)/10 pixel_colors(delay) if buttons.was_pressed(BTN_A): display.clear() display.print(random.choice(answers)) if buttons.was_pressed(BTN_B): break # === end display.clear() pixels.off()